/*=====================================================================
  
  This file is part of the Autodesk Vault API Code Samples.

  Copyright (C) Autodesk Inc.  All rights reserved.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
=====================================================================*/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Autodesk.Connectivity.WebServices;

namespace EffectiveFolderPermissions
{
    public partial class AdminUsersForm : Form
    {
        public AdminUsersForm(List<_UserInfo> users)
        {
            InitializeComponent();

            foreach (_UserInfo user in users)
            {
                if (user._IsAdmin)
                    m_adminsListBox.Items.Add(user.User.Name);
            }
        }

        private void m_adminsListBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.C)
            {
                // copy the list to the clipboard

                StringBuilder listData = new StringBuilder();

                foreach (string value in m_adminsListBox.Items)
                {
                    listData.AppendLine(value);
                }

                Clipboard.Clear();
                Clipboard.SetText(listData.ToString());
            }
        }

      
    }
}